#ifndef BACKUP_H
#define BACKUP_H

#include <QThread>
#include <QStringList>
#include <QDebug>

class Backup : public QThread {

    // This macro is needed because this class will have a signal
    Q_OBJECT


signals:
    void doneBackingUp(unsigned int numFoldersCopied, unsigned int numFilesCopied);
    void copiedBytes(qint64 bytes);

public:
    // Just a simple mutator
    void initializeVariables(QStringList backupList, QString backupPath);

    virtual void run();

    // copies a file
    void copyFile(QString path, QString dest);

    // Copies a folder to the backup directory, maintaining directory structure.
    // 'source' is always the parentmost directory that is found on the backupList
    //
    // For example, if "C:/pics/" is on the list and it contains "summer/" and "fall/",
    // "C:/pics/" is what will be passed as source so that we know all the directories following
    // it are directories to be copied (i.e. backupPath will now contain "summer/" and "fall/"
    void copyFolder(QString source, QString path);


    // These are just mirrors of mainwindow's variables
    QStringList backupList;
    QString backupPath;


    unsigned int numFoldersCopied;
    unsigned int numFilesCopied;
};

#endif // BACKUP_H
